<?php

   /******************************************  
    * 获取店铺分类
    *****************************************/
	require_once ( 'config.inc.php' );
	
	$DBInstance = new DB();
	
	$Taoapi = new Taoapi;
	$Taoapi->method = 'taobao.shopcats.list.get';
	$TaobaoData = $Taoapi->Send('get','xml')->getArrayData();


	$i=0;
	foreach ($TaobaoData['shop_cats']['shop_cat'] as $key => $item){

/*		$i++;
		echo  $item['name'].",".$item['parent_cid'].",".$item['cid'];
		echo '<br>';
*/		
		$sql = "insert into shop_category(cate_name,parent_id,taobao_cid) values('".$item['name']."',".$item['parent_cid'].",".$item['cid'].")";
		
		$DBInstance->Insert($sql);		
		
	}
		echo $i;
	
//	$sql = "select * from  shop_category";	
//	$DBInstance->GetPlan($sql);	
	$DBInstance->Disconnect();	
	
	echo 'finished'
	
?>